Skip to content

script: Wave 6 decompiler lift completeness, typing, delegates, and Roslyn bind improvements - #121

Merged
leonidarider merged 1 commit into
mainfrom
agent/gta6-near-source-w6
Dec 3, 2026
Merged

leonidarider merged 1 commit into
mainfrom
agent/gta6-near-source-w6

Conversation

@leonidarider

Copy link
Copy Markdown
Contributor

Summary

Wave 6 of the GTA VI script decompiler source-likeness and Roslyn bind improvements:

  • 100% Corpus Lift Completeness (lift/sizing.rs):
    • Enforces the single-producer invariant on multi-cell variable stores (0 exceptions across all 416,093 sites in the 745-program corpus), lifting the final unlifted function 0x9EDAAB12::func_1A65F1 (570,117 / 570,117 lifted, 0 unlifted).
  • Delegates, Handles & 4-Byte Struct Conversions (print/prelude, emit, passes/types, print):
    • Adds ScriptDelegate, Handle <-> Cells2, and Entity -> specific handle conversions in Prelude.cs; ClassKind::Delegate +/- operators and 4-byte non-enum value struct conversion operators (HashString etc.) in emit (CS1955 15.6k → 0, CS0149 6.2k → 0, CS0019 +=/-= 6.7k → 183, CS0029 HashString[] 15k → 0).
  • Layouts & Multi-Cell Signatures (project/layouts, project/signatures):
    • Tracks stack value locals and value-type constructor flows (Dictionary.Enumerator.f_0), infers multi-cell Returns::Cells sig.result & slot_result, unifies agreed numeric parameters across virtual slot families (CS0115), and preserves delegate field stability.
  • Managed Typing, Aggregates, Runtime Sugar & Indexers (passes/types, passes/aggregates, passes/sugar_runtime, passes/classes/properties.rs):
    • Protects alloc_managed and managed this from boundary/copy/compare raw poisoning, adds value_receiver for state-machine MoveNext, uses sig.result/slot_result in wide_kind & Around::arg_reads, rewrites value-type builtin instance methods (int.GetHashCode(&p1) → p1.GetHashCode()), and recovers primary & multi-cell List/Dictionary indexers (CS0021 -92%).
  • Emit, Print & Reparse (emit, print, reparse, passes/async_await/calls/twin):
    • Emit-time CS0115 override verification (-79%), with_unsafe head re-laying (heads_laid_fitting 10 → 0), CS0266 object → target casts, native-only ref/out (CS1615 87k → 0) with managed/captured addr(ref ...), outer-method captured locals (CS1686), int → bool script args, foreach (var ...) (CS0030), byte_offset (CS0193), and CS0221 ~0x...UL.

Verification (Full 745-Program Corpus + Roslyn Bind)

All 6 corpus checks passed (index, oracle 0 diffs, reread 19,601, export 745/745 0 failed, compiled 0 diffs, reread-project 19,612):

Metric Stage B Wave 5 (#119) Wave 6 (this PR)
Roslyn bind rate 27.272% 39.401% 42.646% (+3.25 pts, +17,317 funcs)
Roslyn bind-or-missing ~40.9% 67.748% 72.359% (+4.61 pts, +24,663 funcs)
Total Roslyn errors 2,986,265 2,050,587 1,911,867 (−138,720)
Non-missing errors ~1,505,000 737,656 605,330 (−132,326, −17.9%)
Unlifted functions 2 1 0 (570,117 / 570,117 — 100.0%)
->f_N arrows 239,361 152,247 146,005 (−39.0%)
void* declarations 170,970 118,758 113,550 (−33.6%)
heads_laid_fitting 0 10 0

Merge gates passed: or-io lib tests (1,685/1,685), or-cli lib tests (153/153), clippy -p or-io -p or-cli --all-targets -- -D warnings, cargo test --bin openrage doc_ (33/33), just self-check (140/140), pre-commit hook (fmt, encoding, provenance).

…oslyn bind improvements

- Lift sizing: enforce single-producer invariant on multi-cell variable stores (0/416,093 exceptions across corpus), lifting the final unlifted function 0x9EDAAB12::func_1A65F1 (570,117 / 570,117 lifted, 0 unlifted)
- Delegates & conversions: ScriptDelegate in Prelude.cs, Delegate/Combine/Remove typing and invocation, ClassKind::Delegate +/- operators, Handle <-> Cells2 & Entity -> handle conversions, 4-byte struct conversion operators (HashString etc.)
- Layouts & multi-cell signatures: stack value-local and value-constructor flows (Dictionary.Enumerator.f_0), multi-cell Returns::Cells sig.result & slot_result, numeric slot-family param unification, delegate field stability
- Typing, aggregates & indexers: alloc_managed/this protection against boundary/copy/compare raw poisoning, value_receiver for state-machine MoveNext, wide_kind & Around::arg_reads virtual/offset alignment, value-type builtin instance methods (int.GetHashCode), List/Dictionary primary & multi-cell indexers
- Emit, print & reparse: CS0115 emit-time override verification, with_unsafe head re-laying (heads_laid_fitting -> 0), CS0266 object->target casts, CS1615 native-only ref/out + managed/captured addr(ref ...), CS1686 outer-method captured locals, CS1503 int->bool args, foreach (var ...), byte_offset, CS0221 ~0x...UL
@leonidarider
leonidarider merged commit a02c9e5 into main Dec 3, 2026
1 of 2 checks passed
@leonidarider
leonidarider deleted the agent/gta6-near-source-w6 branch December 3, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant